{ "cells": [ { "cell_type": "markdown", "id": "9055aeed-f362-402e-a504-3b20e38feff4", "metadata": {}, "source": [ "# ANISE\n", "\n", "ANISE is a modern rewrite of NAIF SPICE, written in Rust and providing interfaces to other languages include Python.\n", "\n", "Evidently, this tutorial applies to the Python usage of ANISE.\n", "\n", "## Goal\n", "By the end of this tutorial, you should be able to know how to load local and remotes files using the `MetaAlmanac` structure, and know how to save and reload that meta configuration.\n", "\n", "Let's start by installing ANISE: `pip install anise`" ] }, { "cell_type": "markdown", "id": "0ac23885-e0ff-4e38-94a3-85c247befd09", "metadata": {}, "source": [ "## Introduction\n", "\n", "SPICE files, such as development ephemerides, are often substantial in size. Typically, they are stored on shared resources, with links circulated among teams who require access. This process can be cumbersome for end-users, who must ensure they are using the correct file and that it loads properly, irrespective of the script’s execution path.\n", "\n", "The `MetaAlmanac` addresses this challenge by facilitating the initialization of an Almanac using both local and remote files. Remote files are automatically downloaded to the user's application data cache folder (`AppData` on Windows, `~/.local/share/cache` on Linux). For these files, the MetaAlmanac verifies the integrity of any local copy by comparing its CRC32 checksum with that of the remote file.\n", "\n", "Furthermore, the MetaAlmanac guarantees the use of the most up-to-date versions of these files. An example is the daily Earth Orientation Parameters published by JPL, termed the \"high precision Earth rotation\" kernel. The MetaAlmanac enables users to seamlessly access the latest version of these files." ] }, { "cell_type": "code", "execution_count": 1, "id": "28340bbd-490f-4aef-9ada-30c1d4017bcf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\u001b[0;31mInit signature:\u001b[0m \u001b[0mMetaAlmanac\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmaybe_path\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mDocstring:\u001b[0m \n", "A structure to set up an Almanac, with automatic downloading, local storage, checksum checking, and more.\n", "\n", "# Behavior\n", "If the URI is a local path, relative or absolute, nothing will be fetched from a remote. Relative paths are relative to the execution folder (i.e. the current working directory).\n", "If the URI is a remote path, the MetaAlmanac will first check if the file exists locally. If it exists, it will check that the CRC32 checksum of this file matches that of the specs.\n", "If it does not match, the file will be downloaded again. If no CRC32 is provided but the file exists, then the MetaAlmanac will fetch the remote file and overwrite the existing file.\n", "The downloaded path will be stored in the \"AppData\" folder.\n", "\u001b[0;31mFile:\u001b[0m ~/Workspace/nyx-space/anise/anise-py/.venv/lib64/python3.11/site-packages/anise/__init__.py\n", "\u001b[0;31mType:\u001b[0m type\n", "\u001b[0;31mSubclasses:\u001b[0m " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from anise import MetaAlmanac\n", "\n", "MetaAlmanac?" ] }, { "cell_type": "markdown", "id": "f1934f96-030f-4008-bea5-59ba1fed60de", "metadata": {}, "source": [ "## MetaAlmanac configuration\n", "\n", "As seen in the previous cell, a MetaAlmanac is typically initialized using a path to a configuration file (the `maybe_path` argument).\n", "\n", "The configuration file is written in [`Dhall`](https://dhall-lang.org/), an exceptional configuration language known for its safety, expressiveness, and maintainability. Dhall's design simplifies the process of configuring complex systems, making it a standout choice for tasks like initializing the MetaAlmanac.\n", "\n", "Let's see what this looks like:" ] }, { "cell_type": "code", "execution_count": 2, "id": "516ce346-1285-48cc-9940-8bb90620e993", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-- Latest planetary ephemerides, planetary constants, high precision Moon rotation, and daily Earth orientation parameter\n", "{ files =\n", "[ { crc32 = Some 1921414410\n", ", uri = \"http://public-data.nyxspace.com/anise/de440s.bsp\"\n", "}\n", ", { crc32 = Some 2899443223\n", ", uri = \"http://public-data.nyxspace.com/anise/v0.4/pck11.pca\"\n", "}\n", ", { crc32 = Some 2133296540\n", ", uri = \"http://public-data.nyxspace.com/anise/v0.4/moon_fk.epa\"\n", "}\n", ", { crc32 = Some 1817759242\n", ", uri = \"http://public-data.nyxspace.com/anise/moon_pa_de440_200625.bpc\"\n", "}\n", ", { crc32 = None Natural\n", ", uri =\n", "\"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/earth_latest_high_prec.bpc\"\n", "}\n", "]\n", "}\n" ] } ], "source": [ "with open(\"../../data/latest.dhall\") as f:\n", " for line in f.readlines():\n", " print(line.strip())" ] }, { "cell_type": "markdown", "id": "6076d240-713d-4a42-8dfa-a718c222e3a7", "metadata": {}, "source": [ "This is the default MetaAlmanac: it grabs the development ephemerides `DE440s` from the public cloud of Nyx Space, grab a copy of the high fidelity Moon Principal Axes frame, grabs the planetary constant ANISE file `pck08.pca`. It also downloads the latest high precision Earth rotation parameters from JPL.\n", "\n", "The MetaAlmanac comes with a shortcut to download the latest info above without needing a copy of the Dhall file." ] }, { "cell_type": "code", "execution_count": 3, "id": "97824317-42a6-4a5b-8424-7411a2d62ab7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "=== BPC #0 ===\n", "┌─────────────────────────┬───────────────────────────────────┬───────────────────────────────────┬───────────────────────────┬────────────────────┬───────┬────────────────┐\n", "│ Name │ Start epoch │ End epoch │ Duration │ Interpolation kind │ Frame │ Inertial frame │\n", "├─────────────────────────┼───────────────────────────────────┼────────────────────────────��──────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2000-01-01T00:01:04.183912847 TDB │ 2002-09-26T21:18:50.632952778 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2002-09-26T21:18:50.632952778 TDB │ 2005-06-22T18:36:37.081996238 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2005-06-22T18:36:37.081996238 TDB │ 2008-03-18T15:54:23.531035669 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼─────────────────────���─────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2008-03-18T15:54:23.531035669 TDB │ 2010-12-13T13:12:09.980072814 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2010-12-13T13:12:09.980072814 TDB │ 2013-09-08T10:29:56.429117874 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2013-09-08T10:29:56.429117874 TDB │ 2016-06-04T07:47:42.878162558 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2016-06-04T07:47:42.878162558 TDB │ 2019-03-01T05:05:29.327196302 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼──��────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2019-03-01T05:05:29.327196302 TDB │ 2021-11-25T02:23:15.776233885 TDB │ 999 days 21 h 17 min 46 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "├─────────────────────────┼───────────────────────────────────┼───────────────────────────────────┼───────────────────────────┼────────────────────┼───────┼────────────────┤\n", "│ Earth PCK, ITRF93 Frame │ 2021-11-25T02:23:15.776233885 TDB │ 2024-04-19T00:01:09.185602312 TDB │ 875 days 21 h 37 min 53 s │ Chebyshev Triplet │ 3000 │ 17 │\n", "└─────────────────────────┴───────────────────────────────────┴───────────────────────────────────┴───────────────────────────┴────────────────────┴───────┴────────────────┘\n", "=== BPC #1 ===\n", "┌───────────┬───────────────────────────────────┬───────────────────────────────────┬─────────────┬─────────────────��──┬───────┬────────────────┐\n", "│ Name │ Start epoch │ End epoch │ Duration │ Interpolation kind │ Frame │ Inertial frame │\n", "├───────────┼───────────────────────────────────┼───────────────────────────────────┼─────────────┼────────────────────┼───────┼────────────────┤\n", "│ de440.nio │ 1449-12-26T23:59:59.999860483 TDB │ 2426-02-15T23:59:59.999891009 TDB │ 320000 days │ Chebyshev Triplet │ 31008 │ 1 │\n", "├───────────┼───────────────────────────────────┼──���────────────────────────────────┼─────────────┼────────────────────┼───────┼────────────────┤\n", "│ de440.nio │ 2426-02-15T23:59:59.999891009 TDB │ 2650-01-24T23:59:59.999798018 TDB │ 81792 days │ Chebyshev Triplet │ 31008 │ 1 │\n", "└───────────┴───────────────────────────────────┴───────────────────────────────────┴─────────────┴────────────────────┴───────┴────────────────┘\n" ] } ], "source": [ "almanac = MetaAlmanac.latest()\n", "almanac.describe(bpc=True)" ] }, { "cell_type": "markdown", "id": "c1f6515d-3018-4a90-a617-dfe98aae1add", "metadata": {}, "source": [ "The data downloaded from Nyx Space cloud has a checksum in the configuration file: that's because we know exactly what this data should be. Hence, if the data is modified in your local copy, the MetaAlmanac will download it again and replace your local copy. However, the JPL data changes daily, so we don't store a checksum in the config file, ensuring that the latest data is always downloaded.\n", "\n", "ANISE also provides a local config file to use the data stored in a copy of the repo." ] }, { "cell_type": "code", "execution_count": 4, "id": "f748993a-744f-4e9a-be4f-0e637c605486", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-- Default Almanac\n", "{ files =\n", "[ { crc32 = None Natural, uri = \"../../data/de440s.bsp\" }\n", ", { crc32 = None Natural, uri = \"../../data/pck08.pca\" }\n", "]\n", "}\n" ] } ], "source": [ "with open(\"../../data/local.dhall\") as f:\n", " for line in f.readlines():\n", " print(line.strip())" ] }, { "cell_type": "markdown", "id": "44d856cb-10c2-42d0-ab15-614b84538b4a", "metadata": {}, "source": [ "The CRC32 integrity number is not set for local paths because in any case, the MetaAlmanac does not know where to fetch another version where the checksum should match." ] }, { "cell_type": "markdown", "id": "67f031fe-6a51-4aa0-a0c4-619669d04b0e", "metadata": {}, "source": [ "## Using the MetaAlmanac\n", "\n", "The MetaAlmanac is designed to work seamlessly with the Alamac itself. In the following example, we'll use the latest MetaAlmanac (the same that's in `latest.dhall`) and see that it can be used to return the Almanac directly." ] }, { "cell_type": "code", "execution_count": 5, "id": "5d07fd6b-b498-4f33-85f1-9e243a4f0ab1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MetaAlmanac { files: [MetaFile { uri: \"http://public-data.nyxspace.com/anise/de440s.bsp\", crc32: Some(1921414410) }, MetaFile { uri: \"http://public-data.nyxspace.com/anise/v0.4/pck11.pca\", crc32: Some(2899443223) }, MetaFile { uri: \"http://public-data.nyxspace.com/anise/v0.4/moon_fk.epa\", crc32: Some(2133296540) }, MetaFile { uri: \"http://public-data.nyxspace.com/anise/moon_pa_de440_200625.bpc\", crc32: Some(1817759242) }, MetaFile { uri: \"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/earth_latest_high_prec.bpc\", crc32: None }] }\n" ] } ], "source": [ "meta = MetaAlmanac.load(\"../../data/latest.dhall\")\n", "print(meta)" ] }, { "cell_type": "code", "execution_count": 6, "id": "550ec288-15bb-4652-a50c-278d59492bff", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Almanac: #SPK = 1\t#BPC = 2\tPlanetaryData with 54 ID mappings and 0 name mappings\tEulerParameterData with 3 ID mappings and 3 name mappings\n" ] } ], "source": [ "almanac = meta.process()\n", "print(almanac)" ] }, { "cell_type": "markdown", "id": "79813cf7-b7ad-4d56-b315-508a438035f9", "metadata": {}, "source": [ "Trivial! We now see that the loaded Almanac has one loaded SPK file (the de440s file), one BPC file (the latest Earth high precision rotation), and 49 planetary data mappings, loaded from the `pck08.pca`.\n", "\n", "Even simpler, you can just call the `latest()` class method which will call the `latest.dhall` equivalent, without requiring a local configuration file." ] }, { "cell_type": "code", "execution_count": 7, "id": "8826c9a5-a50d-4c93-90b8-1ae45074d058", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Almanac: #SPK = 1\t#BPC = 2\tPlanetaryData with 54 ID mappings and 0 name mappings\tEulerParameterData with 3 ID mappings and 3 name mappings\n" ] } ], "source": [ "print(MetaAlmanac.latest())" ] }, { "cell_type": "markdown", "id": "3cb4db3f-09a4-4ad6-b32d-a7c2c9ba8e3c", "metadata": {}, "source": [ "## Building a MetaAlmanac config\n", "\n", "Building a Dhall configuration for ANISE can be approached in two ways. The most direct method is to craft a Dhall file manually. However, given the complexity often associated with writing in Dhall, ANISE offers a more user-friendly alternative through the `MetaFile` class. This option simplifies the process of creating the necessary data, catering to users who may find direct Dhall scripting challenging." ] }, { "cell_type": "code", "execution_count": 8, "id": "fae8a0c8-15e7-4e98-aaf3-ba0859c64121", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\u001b[0;31mInit signature:\u001b[0m \u001b[0mMetaFile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0muri\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcrc32\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mFile:\u001b[0m ~/Workspace/nyx-space/anise/anise-py/.venv/lib64/python3.11/site-packages/anise/__init__.py\n", "\u001b[0;31mType:\u001b[0m type\n", "\u001b[0;31mSubclasses:\u001b[0m " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from anise import MetaFile\n", "MetaFile?" ] }, { "cell_type": "code", "execution_count": 9, "id": "423b2032-a36c-4863-ba6e-ebd09ed90508", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Almanac: #SPK = 0\t#BPC = 0 (@0x5582525a9d10)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's initialize a new empty MetaAlmanac.\n", "new_meta = MetaAlmanac()\n", "new_meta.process() # Note that you can always initialize an empty MetaAlmanac because you can initialize an empty Almanac" ] }, { "cell_type": "code", "execution_count": 10, "id": "88479168-6c60-438d-958e-86c757a59f04", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'{ files = [{ crc32 = None Natural, uri = \"../../data/de440s.bsp\" }, { crc32 = None Natural, uri = \"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/moon_pa_de440_200625.bpc\" }, { crc32 = None Natural, uri = \"https://google.com/non/existing/pck08.pca\" }] }'" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Create MetaFile instances\n", "local_de = MetaFile(\"../../data/de440s.bsp\")\n", "jpl_moon_rotation = MetaFile(\"https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/moon_pa_de440_200625.bpc\")\n", "non_existing = MetaFile(\"https://google.com/non/existing/pck08.pca\")\n", "# Add them to the meta almanac\n", "new_meta.files = [local_de, jpl_moon_rotation, non_existing]\n", "# And print what this configuration would be:\n", "new_meta.dumps()" ] }, { "cell_type": "markdown", "id": "a8e243d7-1be5-401d-a732-46273e23327e", "metadata": {}, "source": [ "Note that the MetaAlmanac will raise an error in case it cannot download the files. Let's try to load the configuration we just specified." ] }, { "cell_type": "code", "execution_count": 11, "id": "b2f5c44c-473c-4ed3-8d92-18ac3eaa8dca", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\u001b[0;31mSignature:\u001b[0m \u001b[0mnon_existing\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mDocstring:\u001b[0m\n", "Processes this MetaFile by downloading it if it's a URL.\n", "\n", "This function modified `self` and changes the URI to be the path to the downloaded file.\n", "\u001b[0;31mType:\u001b[0m builtin_function_or_method" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# You can call a specific file's `process` method to handle this specific file\n", "non_existing.process?" ] }, { "cell_type": "code", "execution_count": 12, "id": "7d58dc71-0a96-477d-9a41-c7e201704042", "metadata": {}, "outputs": [], "source": [ "# This does nothing because it's a local file\n", "local_de.process()" ] }, { "cell_type": "code", "execution_count": 13, "id": "83437378-9b44-4fcd-a6e8-e774bf098534", "metadata": {}, "outputs": [ { "ename": "Exception", "evalue": "fetching https://google.com/non/existing/pck08.pca returned 404 Not Found", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[13], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Trying to download the non existing file will throw an exception\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[43mnon_existing\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprocess\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[0;31mException\u001b[0m: fetching https://google.com/non/existing/pck08.pca returned 404 Not Found" ] } ], "source": [ "# Trying to download the non existing file will throw an exception\n", "non_existing.process()" ] }, { "cell_type": "code", "execution_count": 14, "id": "e2c35dc9-4efe-4348-ac81-cb7384cf8faf", "metadata": {}, "outputs": [ { "ename": "Exception", "evalue": "processing file #2 (MetaFile { uri: \"https://google.com/non/existing/pck08.pca\", crc32: None }) caused an error: fetching https://google.com/non/existing/pck08.pca returned 404 Not Found", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[14], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Trying to process the full meta almanac with an erroneous meta file will also throw an exception.\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[43mnew_meta\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprocess\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[0;31mException\u001b[0m: processing file #2 (MetaFile { uri: \"https://google.com/non/existing/pck08.pca\", crc32: None }) caused an error: fetching https://google.com/non/existing/pck08.pca returned 404 Not Found" ] } ], "source": [ "# Trying to process the full meta almanac with an erroneous meta file will also throw an exception.\n", "new_meta.process()" ] }, { "cell_type": "markdown", "id": "bbd9e752-a045-4a50-bf65-0fe455b84f0a", "metadata": {}, "source": [ "## Directly loading a MetaFile\n", "\n", "Say you have an `Almanac` loaded with some of your files. And then you'd like to load one file that is stored remotely. You may do so directly with the `load_from_metafile` method of the Almanac.\n", "\n", "**Note:** an Almanac may only load _one_ planetary constants kernel and _one_ Euler parameters kernel. As such, if your Almanac already includes one of these, loading another one will _replace it_. Refer to tutorial #05 on how to build your own PCA and EPA files that include everything you need." ] }, { "cell_type": "code", "execution_count": 15, "id": "577dde0e-9dd5-41b5-9263-0f97fdb78628", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Almanac: #SPK = 1\t#BPC = 0\tPlanetaryData with 54 ID mappings and 0 name mappings\n", "Almanac: #SPK = 1\t#BPC = 0\tPlanetaryData with 54 ID mappings and 0 name mappings\tEulerParameterData with 3 ID mappings and 3 name mappings\n" ] } ], "source": [ "from anise import Almanac\n", "only_de440s = Almanac(\"../../data/de440s.bsp\").load(\"../../data/pck11.pca\")\n", "print(only_de440s)\n", "# Now load a PCA from the Nyx Space cloud\n", "de440s_and_moon = only_de440s.load_from_metafile(MetaFile(\"http://public-data.nyxspace.com/anise/v0.4/moon_fk.epa\", 2133296540))\n", "print(de440s_and_moon)" ] }, { "cell_type": "markdown", "id": "22637388-6a44-42cb-8722-38bf0d570a82", "metadata": {}, "source": [ "To confirm that we've loaded the Moon FK file, let's grab the frame info from the Moon ME and Moon PA frames." ] }, { "cell_type": "code", "execution_count": 16, "id": "3c0466bd-fca6-49e8-9aca-33032bbd4306", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Moon MOON_ME (μ = 4902.800066163796 km^3/s^2, radius = 1737.4 km)\n", "Moon MOON_PA (μ = 4902.800066163796 km^3/s^2, radius = 1737.4 km)\n" ] } ], "source": [ "from anise.astro.constants import Frames\n", "print(de440s_and_moon.frame_info(Frames.MOON_ME_FRAME))\n", "print(de440s_and_moon.frame_info(Frames.MOON_PA_FRAME))" ] }, { "cell_type": "markdown", "id": "a8f2d315-6956-4236-bbf9-67b216ea16bf", "metadata": {}, "source": [ "## Exercises\n", "\n", "### Learning Goals:\n", "\n", "1. Understand the structure and syntax of Dhall configuration files.\n", "1. Learn how to use the MetaFile tool for easier configuration creation.\n", "1. Gain insight into how different configurations affect the MetaAlmanac's operation.\n", "\n", "\n", "### 1. Manual Dhall Configuration:\n", "\n", "+ Create a simple Dhall configuration file.\n", "+ Include basic elements like a specific ephemerides file and a custom planetary constant file.\n", "+ Load this configuration into the MetaAlmanac, observe the behavior, and query the loaded Almanac itself.\n", "\n", "### 2. Using MetaFile:\n", "\n", "+ Use the `MetaFile` class to generate the same configuration.\n", "+ Compare the process of using MetaFile with manual Dhall file creation.\n", "+ Load the generated configuration into the MetaAlmanac.\n", "\n", "_Note:_ Almanac, MetaFile, and MetaAlmana all support the equality operation in Python.\n" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": ".venv" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.4" } }, "nbformat": 4, "nbformat_minor": 5 }